package com.qg.Controller;

import com.qg.service.LocalAlipayService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

@Controller
@RequestMapping("/pay")
public class AlipayController {
    @Resource
    private LocalAlipayService localAlipayService;

    @RequestMapping(value = "/getpage",method = RequestMethod.GET)
    public void getpay(String orderNo, HttpServletResponse response)throws Exception{
        String page=localAlipayService.getPay(orderNo);
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out=response.getWriter();
        out.println(page);
        out.flush();
        out.close();
    }
    @RequestMapping(value = "returnUrl")
    public String returnUrl(HttpServletRequest request)throws Exception{
        String str=localAlipayService.returnUrl(request);
        return str;
    }



}
